<?php
	session_start();
	include('conn.php');
	
	$cid=$_SESSION['id'];
	import_request_variables('pg','v_');
	if (isset($v_csn)){
		$csn=$v_csn;
	}else{
		$csn = '0';
	}
	if (isset($v_ssn)){
		$ssn = $v_ssn;
	}else{
		$ssn = '0';
	}
	
	//check customer ID
	$chk="select * from customers where CustomerID = '$cid'";
	$chk_res=mysql_query($chk,$db);
	$chk_rw=mysql_num_rows($chk_res);
	if ($chk_rw > 0) {
		$chk_r=mysql_fetch_array($chk_res);
		$name=$chk_r['fullname'];
		$ponumber = $chk_r['POnumber'];
		$_SESSION['pono'] = $ponumber;
		$server_now=$_SERVER['SERVER_NAME'];
		echo "<script language=javascript>location.href='https://$server_now/customers/userInfo.php?csn=$csn&ssn=$ssn&cid=$cid&name=$name';</script>";
		exit;
	}
	//
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Check out,Applied Biological Materials Inc.</title>
<link href="../style/css.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form id="form1" name="form1" method="post" action="/customers/userInfo.php">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
  <tr>
    <td height="54" align="center" class="titl2">Checking Out Page </td>
  </tr>
  <tr>
      <td class="cont"><span class="notes">For existing customers</span> who have 
        already set up an account in our company, it is easy for you to retrieve 
        your account information by inputting your Email address and Password. You 
        do not need to re-input your information for your order every time. <br /> 
        <span class="notes"><br />
        For new customers</span>, you need to open a new account with your shipping 
        information for your first order. After your account has been created 
        your information will be retrieved automatically the next time you log 
        into our system.<br/>
        </td>
  </tr>
  <tr>
    <td align="center" valign="top" class="cont"><table width="50%" border="0" cellpadding="1" cellspacing="0" class="cont">
      <tr>
        <td valign="top" bgcolor="#999999">
          <table width="100%" border="0" cellspacing="0" cellpadding="5">
            <tr>
              <td height="37" colspan="2" align="left" bgcolor="#E3EAE8" class="menu">Existing Customer</td>
              </tr>
            <tr>
              <td height="1" colspan="2"></td>
              </tr>
            <tr>
              <td height="15" colspan="2" align="right" bgcolor="#FFFFFF"></td>
              </tr>
            <tr>
              <td width="42%" height="35" align="right" bgcolor="#FFFFFF">Your Email Address  </td>
              <td width="58%" align="left" bgcolor="#FFFFFF"><input name="email" type="text" class="cont-b" id="email" /></td>
            </tr>
            <tr>
              <td height="35" align="right" bgcolor="#FFFFFF">Password</td>
              <td align="left" bgcolor="#FFFFFF"><input name="pwd" type="password" class="cont-b" id="pwd" />
                <input name="csn" type="hidden" id="csn" value="<?php echo $csn;?>" />
                <input name="ssn" type="hidden" id="ssn" value="<?php echo $ssn;?>" /></td>
            </tr>
            <tr>
              <td bgcolor="#FFFFFF">&nbsp;</td>
              <td align="left" bgcolor="#FFFFFF"><input name="Submit" type="submit" class="cont-bg" value=" Go  " /> 
                <a href="/admin/pwdRetrive.htm">Forget your password?</a> </td>
            </tr>
            <tr>
              <td height="15" colspan="2" bgcolor="#FFFFFF"></td>
              </tr>
            <tr>
              <td height="1" colspan="2"></td>
              </tr>
            <tr>
              <td height="26" colspan="2" align="left" bgcolor="#E3EAE8" class="menu">New Customer </td>
              </tr>
            <tr>
              <td colspan="2" align="left" bgcolor="#FFFFFF"><a href="/customers/userAdd.php">Create a new account</a></td>
              </tr>
          </table>         </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="cont">&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>
